package com.lmq.chapter03;

public class demo01 {
    public static void main(String[] args) {
        //Control flow
        /**
         * In Java, the keywords include if-else, while, do-while, for, return, break, and
         * a selection statement called switch.
         */

        // true and false
        System.out.println(1 == 1);
        System.out.println(1 == 2);

        // if - else
        test(10, 5);
        System.out.println(result);
        test(5, 10);
        System.out.println(result);
        test(5, 5);
        System.out.println(result);


        // iteration statements
        while (condition())
            System.out.println("In side 'while'");
        System.out.println("Exited 'while'");


        // for
        for(char c = 0; c < 128; c++)
            if(Character.isLowerCase(c))
                System.out.println("value: " + (int)c +
                        " character: " + c);


    }
    static int result = 0;
    static void test(int testVal, int target) {
        if (testVal > target)
            result = +1;
        else if(testVal < target)
            result = -1;
        else
            result = 0;

    }
    static boolean condition() {
        boolean resultForLoop = Math.random() < 0.99;
        System.out.print(resultForLoop + ", ");
        return resultForLoop;

    }




}
